﻿'#################################################################
'     Программа спроектирована и написана Чернявским Андреем
'              для курсовой работы по информатике,
'        весь код, от начала и до конца написан вручную.
' SVN проекта находится на http://code.google.com/p/testviewerbf/
'#################################################################
Public Class AdminSetting
    'Обявление переменныз переменных.
    Dim setting As New My.MySettings
    'Mysql запросы, для создания бд, и добавление новых записей.
    Public nambern As Integer = 1
    Public sqlq As Integer = 0

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        'Видимость обектов.
        GroupBox2.Enabled = False
        GroupBox1.Enabled = True
        EndForm.Save_history_metod = 0
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        'Видимость обектов.
        GroupBox1.Enabled = False
        GroupBox2.Enabled = True
        EndForm.Save_history_metod = 1
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        'Загрузка из модуля.
        mod_cleanfile()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        'Создания БД MySql.
        sqlq = 1
        mod_MySql()
        sqlq = 0
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        'Присваивание переменных таймера.
        If CheckBox1.Checked = True Then
            Testbox.timer = 1
        End If
        If CheckBox1.Checked = False Then
            Testbox.timer = 0
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Сохранение настроек.
        setting.savemetod = RadioButton1.Checked
        setting.savemetod2 = RadioButton2.Checked
        setting.text1 = TextBox1.Text
        setting.text2 = TextBox2.Text
        setting.text3 = TextBox3.Text
        setting.text4 = TextBox4.Text
        setting.text21 = TextBox5.Text
        setting.text22 = TextBox6.Text
        setting.text23 = TextBox7.Text
        setting.checkl = CheckBox1.Checked
        setting.der1 = RadioButton3.Checked
        setting.der2 = RadioButton4.Checked
        setting.der3 = TextBox8.Text
        setting.Save()
        'Загрузка из модуля.
        maximumvopros()
        Me.Visible = False
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'Закрытие.
        Me.Close()
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        'Видимость обектов и присваивание переменных.
        GroupBox4.Enabled = False
        Module1.derictory = 0
    End Sub

    Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
        'Видимость обектов и присваивание переменных.
        GroupBox4.Enabled = True
        Module1.derictory = 1
    End Sub

    Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
        'Переменная пути загрузки тестов.
        setting.der3 = TextBox8.Text
    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
        'База данных
        setting.text4 = TextBox4.Text
    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        'Пароль
        setting.text3 = TextBox3.Text
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
        'Имя пользователя
        setting.text2 = TextBox2.Text
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        'Логин
        setting.text1 = TextBox1.Text
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Сохранение шрифтов вопроса
        Me.FontDialog1.Font = setting.Font1
        Me.FontDialog1.ShowDialog()
        setting.Font1 = Me.FontDialog1.Font
        setting.Save()
        'Проверка
        Label13.Font = Me.FontDialog1.Font
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        'Сохранение шрифтов вариантов ответа
        Me.FontDialog1.Font = setting.Font2
        Me.FontDialog1.ShowDialog()
        setting.Font2 = Me.FontDialog1.Font
        setting.Save()
        'Проверка
        RadioButton5.Font = Me.FontDialog1.Font
    End Sub

    Private Sub AdminSetting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Загрузка примеров
        Label13.Font = setting.Font1
        RadioButton5.Font = setting.Font2
    End Sub
End Class